package cuit.cx.groupcomment.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import cuit.cx.groupcomment.dao.GrouponDAO;
import cuit.cx.groupcomment.model.Groupon;

public class GrouponDAOImpl extends SqlMapClientDaoSupport implements GrouponDAO {

    public GrouponDAOImpl() {
        super();
    }

   
    public int updateGroupon(Groupon record) {
        int rows = getSqlMapClientTemplate().update("updateGroupon", record);
        return rows;
    }

   
    public int deleteGroupon(Integer id) {
        Groupon key = new Groupon();
        key.setId(id);
        int rows = getSqlMapClientTemplate().delete("deleteGroupon", key);
        return rows;
    }


	@SuppressWarnings("unchecked")
	public List<Groupon> findCurrentGroup(Map<String, Long> map)
	{
		return getSqlMapClientTemplate().queryForList("getCurrentGroup", map);
	}


	@SuppressWarnings("unchecked")
	public List<Groupon> findPastGroup(Map<String, Long> map)
	{
		return getSqlMapClientTemplate().queryForList("getPastGroup", map);
	}


	public Groupon findGrouponById(Integer id)
	{
		return (Groupon) getSqlMapClientTemplate().queryForObject("getGroupById", id);
	}

    
}